<?php
namespace app;

// 应用请求对象类
class Request extends \think\Request
{
    protected $user;
    protected $_attribute  = [];
    function setAttribute($key,$value)
    {
        $this->_attribute[$key] = $value;
    }

    function getAttribute($key)
    {
        return $this->_attribute[$key];
    }

    function setUser($user)
    {
        $this->user =  $user;
    }

    function getUser()
    {
        $user = $this->user;
        if($user instanceof \Closure){
            return $user();
        }
        return $user;
    }

}
